package com.itheima;

public class day14 {
    public static void main(String[] args) {
        //定义数组
        int[] arr = {11,22,33,44,55,66};

        //调用方法
        changeArr(arr,1,5);

        //遍历修改后的数组
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + " ");
        }
    }

    //返回值类型：void 参数列表：int[] arr
    public static void changeArr(int[] arr, int a, int b) {
        //按照索引，交换元素
        int temp = arr[a];
        arr[a] = arr[b];
        arr[b] = temp;
    }
}
